package com.tx.studentManager.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.tx.studentManager.config.SystemConfig;
import com.tx.studentManager.service.UserService;


@Controller
@RequestMapping("/admin")
public class MainController {
	@Autowired
	private UserService userService;
	@Autowired
	private SystemConfig systemConfig;

	@RequestMapping(value="getData")
	public ModelAndView returnData(){
		ModelAndView modelAndView=new ModelAndView();
		Map<String, Object>modelMap=modelAndView.getModel();
		modelMap.put("value", "this is return data");
		modelAndView.setViewName("errorAndException/error");
		return modelAndView;
	}
	
	@RequestMapping("/index")
	public String index(ModelMap modelMap){
		//服务器时间戳
		long timeStamp=System.currentTimeMillis();
		modelMap.put("timeStamp", timeStamp);
		String pageTitle=systemConfig.getPageTitle();
		modelMap.put("title", pageTitle);
		return "admin/index";
	}
	@RequestMapping("/main")
	public String main(){
		return "admin/main";
	}
}
